# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models

# Create your models here.
class Article(models.Model):
    title = models.CharField(max_length=64)
    content = models.FileField(upload_to='article/')
    create_time = models.DateTimeField(auto_now_add=True)
    update_time = models.DateTimeField(auto_now=True)


class Tag(models.Model):
    name = models.CharField(max_length=32)


class ArticleTitle(models.Model):
    article_id = models.ForeignKey(Article)
    tag_id = models.ForeignKey(Tag)


class Message(models.Model):
    nickname = models.CharField(max_length=32)
    content = models.CharField(max_length=256)
    typ = models.IntegerField(choices=((1, '文章留言'), (2, '反馈留言')))
    create_time = models.DateTimeField(auto_now_add=True)


class Reply(models.Model):
    message_id = models.ForeignKey(Message)
    content =  models.CharField(max_length=256)
    from_user = models.CharField(max_length=32)
    to_user = models.CharField(max_length=32)
    create_time = models.DateTimeField(auto_now_add=True)


class OperateLog(models.Model):
    user = models.CharField(max_length=32)
    content = models.CharField(max_length=64)
    create_time = models.DateTimeField(auto_now_add=True)